package com.example.pet.controller;

import com.example.pet.beans.MsgInfo;
import com.example.pet.common.Result;
import com.example.pet.service.IMsgInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liukai
 * @version 1.0.0
 * @ClassName MsgInfoController.java
 * @Description TODO
 * @createTime 2021年04月28日 11:22:00
 */
@RestController
@RequestMapping(value = "/msg")
public class MsgInfoController {

    @Autowired
    private IMsgInfoService iMsgInfoService;

    @PostMapping(value = "/addMsg")
    public Result addMsg(@RequestBody MsgInfo msgInfo){
        int i = iMsgInfoService.addMsg(msgInfo);
        return Result.succ(i);
    }

    @PostMapping(value = "/findMsgById")
    public Result findMsgById(@RequestBody MsgInfo msgInfo){
        return iMsgInfoService.findMsgById(msgInfo.getSendId(),msgInfo.getReceiveId());
    }

}
